const {app,assert} = require('egg-mock/bootstrap');
describe('test/controller/users.test.js',function(){
    it('add',async function(){
        let result = await app.httpRequest().get('/add');
        assert(result.status == 200);
        assert(result.text.indexOf('form')!=-1);
    });
    it('doAdd',async function(){
       let user = {username:'zhufeng',password:'123456'};
       app.mockCsrf();//提供CSRF支持
       let result = await app.httpRequest().post('/doAdd').send(user);
       //console.log(result);
       assert(result.body.id == 1); 
    });
});